package com.maolong.exception;

import com.maolong.entity.format.Code;
import com.maolong.entity.format.RespResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;



@Slf4j
@RestControllerAdvice
public class MyExceptionHandler {

    @ExceptionHandler(ServerException.class)
    public RespResult handleServerException(ServerException e){
        log.info("服务器异常:{}",e.getMessage());
        return new RespResult(Code.EXCEPTION,null,e.getMessage());
    }
}
